<?php

namespace app\common\service;

use app\common\service\Base;
use app\common\model\SceneItem as SceneItemModel;

class SceneItem extends Base {

     public function __construct() {
         parent::__construct();
         $this->currentModel = new SceneItemModel();
     }

    /**
     * 场景小节列表
     * @param $sceneId
     * @return array|\PDOStatement|string|\think\Collection
     */
     public function getSceneItemList($sceneId) {

         return $this->currentModel
             ->where([
                 'scene_id' => $sceneId,
                 'status' => config('enum.sceneStatus.valid.value')
             ])
             ->order('sort asc')
             ->select();
     }

    /**
     * 获取sort最大值
     * @param $sceneId
     * @return array|null|\PDOStatement|string|\think\Model
     */
    public function getMaxSortBySceneId($sceneId) {

        return $this->currentModel
            ->where('scene_id', $sceneId)
            ->order('sort desc')
            ->find();

    }

}